<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="sealte.hvpms.pojo.*,sealte.hvpms.dao.impl.*,sealte.hvpms.util.HVPMSTools,java.util.*" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
	String fid_str = request.getParameter("fid");
	if(fid_str!=null&&!fid_str.equals("")&&HVPMSTools.isNum(fid_str)){
		int id = Integer.parseInt(fid_str);
%>
<html>
<head>
<base href="<%=basePath%>"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>仓鼠网上投票系统HVPMS</title>
<link rel="icon" href="favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link href="css/jQuery.spider.poll.css" rel="stylesheet" type="text/css" />
<script src="js/jquery-1.4.4.min.js" type="text/javascript"></script>
<script src="js/jQuery.spider.poll-min.js" type="text/javascript"></script>
<script type="text/javascript">
<%
	Iterator<PollOption> iter = (new PollOptionDAOImpl()).getPOAll(id).iterator();
	Poll poll = (new PollDAOImpl()).getPoll(id);
	StringBuffer sb = new StringBuffer();
	sb.append("{root:[");
	int i = 0;
	while(iter.hasNext()){
		i++;
		PollOption po = iter.next();
		if(i==1){
			sb.append("{id:'"+po.getId()+"',name:'"+po.getContent()+"',value:'"+po.getCounter()+"'}");
		}else{
			sb.append(",{id:'"+po.getId()+"',name:'"+po.getContent()+"',value:'"+po.getCounter()+"'}");
		}
	}
	sb.append("]}");
%>
var data="<%=sb.toString()%>"; 

$(document).ready(function (){
	$("#poll_res_show").poll("poll1",{
		title:'<%=poll.getName()%>',
		width:'900px',
		data:data
	});	
});

</script>
</head>
<body bgcolor="#F9F9F9">
<div id="poll_res_show"></div>
</body>
</html>
<%	
	}else{
		out.println("出错了。。。");
	}
%>